﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;
using GauntletFramework.Input;

namespace GauntletFramework.Texture
{
    public static class Gradiant
    {
        public static Texture2D VerticalGradiant(GraphicsDevice GraphicsDevice, Color Top, Color Bottom)
        {
            Texture2D Texture = new Texture2D(GraphicsDevice, 1, 2);
            uint[] data = { Top.PackedValue, Bottom.PackedValue };
            Texture.SetData<uint>(data);
            
            return Texture;
        }

        public static Texture2D HorizontalGradiant(GraphicsDevice GraphicsDevice, Color Left, Color Right)
        {
            Texture2D Texture = new Texture2D(GraphicsDevice, 2, 1);
            uint[] data = { Left.PackedValue, Right.PackedValue };
            Texture.SetData<uint>(data);
            
            return Texture;
        }

        public static Texture2D OutwardGradiant(GraphicsDevice GraphicsDevice, Color Center, Color Outer)
        {
            Texture2D Texture = new Texture2D(GraphicsDevice, 3, 3);
            Color Offset = new Color((byte)(Outer.R * 0.70710678f + Center.R * 0.2928932188f), (byte)(Outer.G * 0.70710678f + Center.G * 0.2928932188f), (byte)(Outer.B * 0.70710678f + Center.B * 0.2928932188f), (byte)(Outer.A * 0.70710678f + Center.A * 0.2928932188f));
            uint[] data = { Outer.PackedValue, Offset.PackedValue, Outer.PackedValue, Offset.PackedValue, Center.PackedValue, Offset.PackedValue, Outer.PackedValue, Offset.PackedValue, Outer.PackedValue };
            Texture.SetData<uint>(data);
            
            return Texture;
        }
    }
}
